<template>
  <div class="One">
    <div>One a的数据是{{ a }}</div>
    <button @click="$emit('fn1')">fn1</button>
    <Two v-bind="$attrs" v-on="$listeners" />
  </div>
</template>

<script>
import Two from "./Two";
export default {
  name: "One",
  components: {
    Two,
  },
  props: ["a"],
  mounted() {
    /* 
      $attrs:接受父组件传递过来的props,不包含已经在当前组件接受的props和动态样式
    */
    console.log(this.$attrs);
    console.log(this.$listeners);
  },
};
</script>

<style scoped>
.One {
  border: 1px solid #000;
}
</style>
